package smarture;

public class QState implements java.io.Serializable{

	private static final long serialVersionUID = -8251667290067355131L;
	private int cooldown;
	private int distanceState;
	private int enemyCount;
	private int healthState;
	public QState(int cooldown, int distanceState, int enemyCount, int healthState) {
		
		this.cooldown = cooldown;
		this.distanceState = distanceState;
		this.enemyCount = enemyCount;
		this.healthState = healthState;
	}
	
	@Override
	public boolean equals(Object o)
	{
		if( o instanceof QState )
		{
			QState q = (QState)o;
			return this.cooldown == q.cooldown 
					&& this.distanceState == q.distanceState 
					&& this.enemyCount == q.enemyCount 
					&& this.healthState == q.healthState;
		}
		return false;
	}
	
	@Override
	public int hashCode() {
		int result = 0;
		result += cooldown * (2 << 0);
		result += distanceState * (2 << 1);
		result += enemyCount * (2 << 2);
		result += healthState * (2 << 3);
		return result;
	}
	
	@Override
	public String toString()
	{
		return String.format("cd %d,  distance %d, enemy %d, health %d",cooldown,distanceState,enemyCount,healthState);
	}
	
}
